
import urllib.request
import gevent

def downloader(file_name,url):
    response = urllib.request.urlopen(url)
    content = response.read()
    with open(file_name,"wb") as f:
        f.write(content)

def main():
    url1 = "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1552995766572&di=d1c8f565c45df04f19dfe2bad063ad40&imgtype=0&src=http%3A%2F%2Fphoto.16pic.com%2F00%2F03%2F12%2F16pic_312797_b.jpg"
    url2 = "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1553590511&di=ad0a502c0e31e228139edfd56a6fddf8&imgtype=jpg&er=1&src=http%3A%2F%2Fb.hiphotos.baidu.com%2Fzhidao%2Fpic%2Fitem%2F4610b912c8fcc3cef284728b9945d688d53f20c5.jpg"

    gevent.joinall([
        gevent.spawn(downloader,"1.jpg",url1),
        gevent.spawn(downloader,"2.jpg",url2)
    ])

if __name__ == '__main__':
    main()